 /**
 * jims
 */
 package com.jims.master.modules.sync.service;


import com.jims.master.common.persistence.Page;
import com.jims.master.common.service.CrudService;
import com.jims.master.modules.sync.dao.PrescriptionEnDao;
import com.jims.master.modules.sync.entity.PrescriptionEn;
import com.jims.master.modules.sync.entity.PrescriptionEnDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;


 /**
 * Service
 * @author ct
 * @version 2017-11-16
 */
@Service
@Transactional(readOnly = true)
public class PrescriptionEnService extends CrudService<PrescriptionEnDao, PrescriptionEn> {

	 @Autowired
	 private PrescriptionEnDetailsService prescriptionEnDetailsService;

	@Override
    public PrescriptionEn get(String id) {
		return super.get(id);
	}

	@Override
    public List<PrescriptionEn> findList(PrescriptionEn prescriptionEn) {
		return super.findList(prescriptionEn);
	}

	@Override
    public Page<PrescriptionEn> findPage(Page<PrescriptionEn> page, PrescriptionEn prescriptionEn) {
		return super.findPage(page, prescriptionEn);
	}
	
	@Override
    @Transactional(readOnly = false)
	public int save(PrescriptionEn prescriptionEn) {
		return super.save(prescriptionEn);
	}
	
	@Override
    @Transactional(readOnly = false)
	public int delete(PrescriptionEn prescriptionEn) {
		return super.delete(prescriptionEn);
	}

	 public List<PrescriptionEn> getByBillingId(PrescriptionEn prescriptionEn){
		 return dao.getByClinicId(prescriptionEn);
	 };

	 /**
	  * 保存西药处方
	  * @param map
	  * @return
	  */
	 @Transactional(readOnly = false)
	 public int savePrescriptionEn(Map map){
		 PrescriptionEnDetails prescriptionEnDetails = new PrescriptionEnDetails();
		 int i = 0;
		 //this.save(prescriptionEn);
		 //prescriptionEnDetails.setBillingId(prescriptionEn.getId());
		 //prescriptionEnDetailsService.save(prescriptionEnDetails);
		 return i;
	 }
	
}